import javax.swing.border.TitledBorder;

/**
 * Created by losor on 2016/9/30.
 */
public class _171_Excel_Sheet_Column_Number    {
    public static void main(String[] args) {
        System.out.println(titleToNumber("AA"));
    }

    public static int titleToNumber(String s) {
        int sum = 0;
        StringBuilder stringBuiler = new StringBuilder(s);
        for (int i = 0; i < stringBuiler.length(); i++) {
            sum = sum * 26;
            sum += (stringBuiler.charAt(i)-'A' + 1);
        }
        return sum;
    }
}
